<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" >
<head>
	<th:block th:include="include :: header('修改标签报警历史')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-tagAlarmData-edit" th:object="${tagAlarmData}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
			<div class="form-group">
				<label class="col-sm-3 control-label">标签ID：</label>
				<div class="col-sm-8">
					<input id="tagId" name="tagId" th:field="*{tagId}" class="form-control" type="text" readonly>
				</div>
			</div>
<!--			<div class="form-group">-->
<!--				<label class="col-sm-3 control-label">报警产生时间：</label>-->
<!--				<div class="col-sm-8">-->
<!--					<input id="alarmTS" name="alarmTS" th:field="*{alarmTS}" class="form-control" type="text" readonly>-->
<!--				</div>-->
<!--			</div>-->
			<div class="form-group">
				<label class="col-sm-3 control-label">报警类型：</label>
				<div class="col-sm-8">
					<input id="alarmType" name="alarmType" th:field="*{alarmType}" class="form-control" type="text" readonly >
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label"><span style="color: red; ">*</span>处理意见：</label>
				<div class="col-sm-8">
					<textarea  type="text" id="context" name="context" th:field="*{context}"  class="form-control" placeholder="请输入文本" required></textarea>
				</div>
			</div>
			<input id="status" name="status" value="1"  class="form-control" type="hidden">
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" th:field="*{remark}" class="form-control" type="text">
				</div>
			</div>
			<hr/>
			<div shiro:hasPermission="system:tagAlarmData:edit">
<!--				style="text-align: center;margin-left: -15px;margin-right: -15px"-->
				<div class="form-group" id="devquickText1" style="margin-left: 100px; margin-right: -100px;" >
					<button type="button" onclick="copy('quickText1')" class="btn btn-info" style="float: left;">处理意见1</button>
					<div class="col-sm-8">
						<input id="quickText1" onclick="copy('quickText1')" name="quickText1"  class="form-control" type="text" readonly>
					</div>
				</div>
				<div class="form-group" id="devquickText2" style="margin-left: 100px; margin-right: -100px;">
					<button type="button" onclick="copy('quickText2')" class="btn btn-info" style="float: left">处理意见2</button>
					<div class="col-sm-8">
						<input id="quickText2" onclick="copy('quickText2')" name="quickText2" class="form-control" type="text" readonly>
					</div>
				</div>
				<div class="form-group" id="devquickText3" style="margin-left: 100px; margin-right: -100px;">
					<button type="button" onclick="copy('quickText3')" class="btn btn-info" style="float: left">处理意见3</button>
					<div class="col-sm-8">
						<input id="quickText3" onclick="copy('quickText3')" name="quickText3" class="form-control" type="text" readonly>
					</div>
				</div>
				<div class="form-group" id="devquickText4" style="margin-left: 100px; margin-right: -100px;">
					<button type="button" onclick="copy('quickText4')" class="btn btn-info" style="float: left">处理意见4</button>
					<div class="col-sm-8">
						<input id="quickText4" onclick="copy('quickText4')" name="quickText4" class="form-control" type="text" readonly>
					</div>
				</div>
				<div class="form-group" id="devquickText5" style="margin-left: 100px; margin-right: -100px;">
					<button type="button" onclick="copy('quickText5')" class="btn btn-info" style="float: left">处理意见5</button>
					<div class="col-sm-8">
						<input id="quickText5"  onclick="copy('quickText5')" name="quickText5" class="form-control" type="text" readonly>
					</div>
				</div>
			</div>

		</form>

<!--			<label>选择常用处理意见：</label>-->
<!--		<div id="append" style="text-align: center">-->

<!--		</div>-->


    </div>
    <div th:include="include::footer"></div>
    <script  th:inline="javascript">
		var prefix = ctx + "system/tagAlarmData";
		$(function(){
			$('input:not([autocomplete]),textarea:not([autocomplete]),select:not([autocomplete])').attr('autocomplete', 'off');
		});
		var alarmQuickTextList = [[${alarmQuickTextList}]];
		$("#form-tagAlarmData-edit").validate({
			rules:{
				context: {
					required: true,
					maxlength:100
				},
			},
			focusCleanup: true
		});
		// $(function () {
		// 	var html = '';
		// 	if (alarmQuickTextList.length>0){
		// 		for (i=0;i<alarmQuickTextList.length;i++){
		// 			html+='<button type="button" class="btn btn-info" style="margin-top: 10px;margin-left: 10px"  onclick="copy(\'' + alarmQuickTextList[i].quickText + '\')" >'+alarmQuickTextList[i].quickText+'</button>';
		// 		}
		// 	}
		// 	$("#append").append(html);
		// })
		$(function () {
			$("#devquickText1").hide();
			$("#devquickText2").hide();
			$("#devquickText3").hide();
			$("#devquickText4").hide();
			$("#devquickText5").hide();
			if (alarmQuickTextList.length>0){
				for (i=0;i<alarmQuickTextList.length;i++){
					$("#quickText"+(i+1)).val(alarmQuickTextList[i].quickText);
					$("#devquickText"+(i+1)).show();
				}
			}
		})
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-tagAlarmData-edit').serialize());
	        }
	    }
	    function copy(v) {
			var val = $("#"+v).val();
			$("#context").val(val);
		}
	</script>
</body>
</html>
